From: svermeul@suntzu.psg.datap.ca (Stephen Vermeulen) Message-Id: <199603221847.LAA15205@alien.psg.datap.ca> To: mui@sunsite.Informatik.RWTH-Aachen.DE Subject: MUI FAQ: Misbehaving check mark gadgets X-Sun-Charset: US-ASCII Resent-Message-Id: <"wzSFg3.0.z_.PPlKn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List:archive/latest/747 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 1123 X-Lines: 29 Status: RO Here's a question and answer for the MUI FAQ: Q: Why don't CheckMark gadgets that I have created with CheckMark(TRUE) behave properly until the user has clicked twice on them? A: You might be requesting notification on the WRONG attribute of the CheckMark. For example you create the check mark with code like: Child, Label2("Allow duplicates:"), Child, ck6 = CheckMark(TRUE), Then you set up notification with: DoMethod(ck6, MUIM_Notify, MUIA_Pressed, MUIV_EveryTime, < NOTE THIS LINE IS app, 2, MUIM_Application_ReturnID, ACT_CK6); < INCORRECT!!!! perhaps because you have cut and pasted from a regular button. What you really should have done is: DoMethod(ck6, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, app, 2, MUIM_Application_ReturnID, ACT_CK6); The confusing thing about this bug is that it only affects CheckMark(TRUE) objects (or if you use MUIM_Application_Load to restore the state of checkmarks then those that become set to TRUE will exibit the same problem). Regards, Stephen From: totel@laas.fr (Eric Totel) Subject: DragDrop method Resent-Message-Id: <"RZEAj2.0.cy.6fNnm"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/16 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 15 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 418 Hi ! I think there is either some thing i did not understand, or something wrong with the arguments received by this method (MUIM_DragDrop). I should receive the x and y coordinate of the mouse at the drop time, shouldn't I ?? It seems their values are always 0 ... I fixed this by using the DragReport method to save the xmouse and ymouse to global variables available for use in the DragDrop method ... Eric. From: "Stefan Stuntz" Date: Fri, 15 Mar 1996 20:22:41 +0100 X-Mailer: IntuiNews 1.3b Beta 7 (2.2.96) Subject: MUIA_ObjectID, MUIM_Import/Export, MUIM_Dataspace_Find Message-Id: <81320055@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-Id: <"Xyc7E3.0.O91.6wTIn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/652 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 2152 X-Lines: 60 Status: RO Michal Kracik wrote in article <0099F53C.E1F81E4A.25@cs.felk.cvut.cz>: > >RESULT > > > >Always return 0 or the value from DoSuperMethod() if you want > >your parent classes to be able to import theirselves. > > I don't understand when should I return 0 and when the value from > DoSuperMethod(). RESULT Return 0 if you dont want your superclasses to be able to import/export any values themselves. Otherwise return(DoSuperMethodA(cl,obj,msg)); > >EXAMPLE > > > >ULONG mImport(struct IClass *cl,Object *obj,struct MUIP_Import *msg) > >{ > > struct Data *mydata = INST_DATA(cl,obj); > > ULONG id; > > ULONG *data; > > > > if (id=(muiNotifyData(obj)->mnd_ObjectID)) > ^^^^^^^^^^^^ > If the macro "muiNotifyData" returns address of Notify class'es instance > data (a pointer to struct MUI_NotifyData), what is this "mnd_ObjectID" > member? It is not defined in mui.h as a member of struct MUI_NotifyData > (unless it is private, but then why does it appear in this example? :-) > Another strange thing is that MUIA_ObjectID is an atribute of Area class > and not Notify class, why should mnd_ObjectID be in Notify's instance data? This is a documentation bug. MUIA_ObjectID of course belongs to notify class. Also, the mnd_ObjectID in the instance data structure was accidently made private. Here it is: struct MUI_NotifyData { struct MUI_GlobalInfo *mnd_GlobalInfo; ULONG mnd_UserData; ULONG mnd_ObjectID; }; > > if (data = (ULONG *)DoMethod(msg->dataspace,MUIM_Dataspace_Find,id)) > ^^^^^^^^^^^^^^^^^^^ > MUIM_Dataspace_Find is neither documented in the autodoc for Dataspace > class nor defined in mui.h. I think somebody on this list already complained > about it but AFAIK he did not get answer. Also a little "privacy" accident. #define MUIM_Dataspace_Find 0x8042832c /* V11 */ struct MUIP_Dataspace_Find { ULONG MethodID; ULONG id; }; It returns the pointer you added with MUIM_Dataspace_Add or NULL when the id was not found in the dataspace. -- Greetings, Stefan From: svermeul@suntzu.psg.datap.ca (Stephen Vermeulen) Message-Id: <199604032252.PAA05495@alien.psg.datap.ca> To: mui@sunsite.Informatik.RWTH-Aachen.DE Subject: Re: MUI FAQ question, answer wanted... X-Sun-Charset: US-ASCII Resent-Message-Id: <"koF3l1.0.uv2.A7mOn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/912 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 744 X-Lines: 28 Status: RO > > Question: > > > > Through the MUIM_Application_Load and MUIM_Application_Save methods > > objects > > with MUIA_ObjectIDs will be automatically saved and restored. If one > > makes > > a custom class that contains some objects of the type that > > Application_Load > > and Save can handle, how (if at all) does one get MUI to save and restore > > these objects? > > See autodocs of MUIM_Export/MUIM_Import. I see the light, well I think I do, I'll have to write some code now. You should really add Export/Import to the "SEE ALSO" line of Application_Load/Save. An addition to the C/Examples directory which used this stuff (and perhaps the dataspace too) would be useful. > -- > Greetings, Stefan > Thanks, Stephen From: Adolf@cmb.dssd.sub.org (Adolf Markus Berthold) X-Zc-Dinoex-Path: dinoex.sub.org!CMB.DSSD.SUB.ORG!Adolf Subject: Re: custom class attributes Date: Fri, 05 Apr 1996 18:01:32 +0200 X-Mailer: -- The Answer V3.05 References: <224AECE8H000B8385H@adolf.cmb.dssd.sub.org> <1797.6662T639T2770@public.ndh.com> X-Gateway: ZCONNECT UD gate.dinoex.sub.org [UNIX/Connect v0.73-m9] Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Zc-Post: 50997 Koeln ; Blasiusstr. 13 X-Zc-Telefon: V+49-2232-67523 X-Zc-Via: 19960406161415S+2@CMB.DSSD.SUB.ORG X-Zc-Via: 19960407002127W+1@dinoex.sub.org X-Zc-X-Reply-Level: 1 Lines: 87 Resent-Message-Id: <"nZFia1.0.v03.ULnPn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/956 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 88 Status: RO Content-Type: text/plain; charset="ISO-8859-1" Content-Length: 3004 On Fr 29.03.1996 at 21:21:37 you wrote in Message "Re^1:custom class attributes" Hi Marcel Jantz! MJ-> >I created a subclass of group class wich contains 6 slider MJ-> >objects and a default button. This new class, called MJ-> >"GrenzAdjustClass" has got an attribute MA_GrenzAdjust_Status, MJ-> >which is a pointer to a special structure, containing all those MJ-> >slider values. MJ-> >If I set this attribute, I want the slider objects to be updated. MJ-> MJ-> Assuming that your "GrenzAdjustClass" is derived from groupclass MJ-> you can call every child's set-method. I for one use to create my MJ-> own list of all childs to store additional informations of them MJ-> in the nodes too. I am not sure, if you have understood my problem ( or if I understood your explanation :) : My "GrenzAdjustClass" has an attribute called "MA_GrenzAdjust_Value", which is a pointer to the following structure: struct GrenzInfo { ULONG Min[3]; ULONG Max[3]; }; OK, I agree, that the groupclass/OM_SET code will pass on every OM_SET method to every child (doesn't it ?). But the slider's class doesn't know about MA_GrenzAdjust_Value and will ignore it. So nothing will happen, which is not exactly what I thought about ...... :) If I invoke a set(,MUIA_Numeric_Value,) on my class, it will pass on and all the sliders will be set to the same value, what is also not what I want. Now you might say, that I have to write a subclass of sliderclass that reacts to the MA_GrenzInfo_Value attribute, but where does that new class know from, what field of the struct GrenzInfo it has to read out ? So the only way to make MA_GrenzInfo setable is to include the following code into my classe's OM_Set: { int i; struct GrenzInfo *Gr = (struct GrenzInfo *)(tag->ti_Data); for (i=0;i<3;i++) { nnset(data->MinSlider[i], MUIA_Numeric_Value, Gr->Min[i] ); nnset(data->MaxSlider[i], MUIA_Numeric_Value, Gr->Max[i] ); } } MJ-> >If I get this attribute, I want to get the current slider values. MJ-> MJ-> Same as above. yes, same as above: If I ask for MA_GrenzInfo_Value, neither my class, nor any child will know about it. If I ask for MUIA_Numeric_Value, all the childs will answer and only the last value will survive in the storage area. So the only way to make MA_GrenzInfo_Value getable is to include the following code into my classe's OM_GET: { int i; struct GrenzInfo *Gr = (struct GrenzInfo *)store; for (i=0;i<3;i++) get(data->MinSlider[i], MUIA_Numeric_Value, &(Gr->Min[i])); for (i=0;i<3;i++) get(data->MaxSlider[i], MUIA_Numeric_Value, &(Gr->Max[i])); } O.K. .. so far so good. That already works fine. But nor there comes the main question: How can I get a notification event triggered, when the user changes the sliders ?? MJ-> Mybe the problem is that you do not call the superclass in your set method or MJ-> that you do not set the correct trigger attribute/value pair. No, that is not the problem. From: Adolf@cmb.dssd.sub.org (Adolf Markus Berthold) X-Zc-Dinoex-Path: dinoex.sub.org!CMB.DSSD.SUB.ORG!Adolf Subject: Re: custom class attributes Date: Fri, 05 Apr 1996 22:32:25 +0200 X-Mailer: -- The Answer V3.05 References: <1797.6662T639T2770@public.ndh.com> <199604011448.QAA14132@ogpsrv.unice.fr> X-Gateway: ZCONNECT UD gate.dinoex.sub.org [UNIX/Connect v0.73-m9] Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Zc-Post: 50997 Koeln ; Blasiusstr. 13 X-Zc-Telefon: V+49-2232-67523 X-Zc-Via: 19960407011746S+2@CMB.DSSD.SUB.ORG X-Zc-Via: 19960408001623W+1@dinoex.sub.org X-Zc-X-Reply-Level: 1 Lines: 23 Resent-Message-Id: <"_38Bd3.0.pP.m79Qn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/964 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 24 Status: RO Content-Type: text/plain; charset="ISO-8859-1" Content-Length: 825 On Mo 01.04.1996 at 17:48:17 you wrote in Message "Re^1:custom class attributes " Hi Gilles Masson! GM-> > Mybe the problem is that you do not call the superclass in your set method or GM-> > that you do not set the correct trigger attribute/value pair. GM-> GM-> For me, it works only since i made a get method for the same tag. GM-> I think that a get is made which must succeed and return a different GM-> value from the set one to make a notify. Somewhere in docs, it's said GM-> that a set(...) make a notification only if the value change, and i don't GM-> see any other way mui could use to test that... Yes .. I also experienced that ... But I didn't use a different value. I made the OM_Set code store the value and I made the OM_GET code return exactly that stored one. From: m.jantz@public.ndh.com (Marcel Jantz) To: mui@sunsite.Informatik.RWTH-Aachen.DE Subject: Re: custom class attributes In-Reply-To: <224AECE8H000B8385H@adolf.cmb.dssd.sub.org> <1797.6662T639T2770@public.ndh.com> <22592F0CH00031EEBH@adolf.cmb.dssd.sub.org> Message-Id: <2581.6673T754T1079@public.ndh.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED* Lines: 79 Resent-Message-Id: <"WjkkY2.0.pl6.M_aQn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/976 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 80 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 2582 >On Fr 29.03.1996 at 21:21:37 you wrote in Message "Re^1:custom class >attributes" >Hi Marcel Jantz! Hi, >OK, I agree, that the groupclass/OM_SET code will pass on every >OM_SET method to every child (doesn't it ?). I think (but am not sure), that the group class does NOT spread the new attribute to all of it's members. I guess that's why there is the new MUIA_Group_ChlidList attribute. >But the slider's class >doesn't know about MA_GrenzAdjust_Value and will ignore it. So nothing >will happen, which is not exactly what I thought about ...... :) Which is logical. >If I invoke a set(,MUIA_Numeric_Value,) on my class, it will pass on and >all the sliders will be set to the same value, what is also not what I >want. >Now you might say, that I have to write a subclass of sliderclass that >reacts to the MA_GrenzInfo_Value attribute, but where does that new >class know from, what field of the struct GrenzInfo it has to read out ? One solution could be to implement a method in your group-class, which gets a object pointer (the slider that sould be set with the MA_GrenzInfo_Value) and the new value, which has there to be translated into the MUIA_Slider_Level attribute. This would hide the struct GrenzInfo and make it possible to allow you class to set diffent kinds of values in different kinds of objects (as the group knows how to remap the MA_GrenzAdjust_Value to something meaningful for the given object type... But this is the most objectoriented method (IMO), you can of course simply let the slider know about the struct GrenzInfo.... >So the only way to make MA_GrenzInfo setable is to include the following >code into my classe's OM_Set: >{ > int i; > struct GrenzInfo *Gr = (struct GrenzInfo *)(tag->ti_Data); > for (i=0;i<3;i++) > { > nnset(data->MinSlider[i], MUIA_Numeric_Value, Gr->Min[i] ); > nnset(data->MaxSlider[i], MUIA_Numeric_Value, Gr->Max[i] ); > } >} Well, which is what I meant be storing a list of the childs and than working with this list... >O.K. .. so far so good. That already works fine. >But nor there comes the main question: >How can I get a notification event triggered, >when the user changes the sliders ?? By creating a triggernotification on every slider and listen to it ?? As you already have a list of the children, this shouldn't be the problem, should it ?? > +------+ > | Addi | > +------+ ___________________________________________________________ "Nevertheless smart people still need to eat and pay rent." Marcel Jantz (McMaJa) Techn. Support ProDev From: "Stefano Agostinelli" Date: Sun, 14 Apr 1996 12:40:20 +0100 X-Mailer: IntuiNews 1.3 (27.8.95) Subject: Re: Notify in MCC Message-Id: <65641430%agos001@pn.itnet.it> Resent-Message-Id: <"Xw_fL.0.aJ6.z3HSn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1045 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 920 X-Lines: 20 Status: RO Hans Henrik Happe wrote in a Mail about "Notify in MCC": > How do you Notify other objects, when an attribute of your object > is changed? The standard BOOPSI way don't work for me. Some example > code would be nice - please (Stafan: maybee you should put some in > the next release). "other objects" have to request notification via MUIM_Notify. Read MUIC_Notify AutoDoc for its usage. Cheers Stefano From: Jason S Birch Message-Id: <199604150313.LAA08905@decadence> Subject: Re: Notify in MCC To: mui@sunsite.Informatik.RWTH-Aachen.DE Date: Mon, 15 Apr 1996 11:13:14 +0800 (WST) In-Reply-To: from "Hans Henrik Happe" at Apr 14, 96 11:14:08 pm X-Mailer: ELM [version 2.4 PL25] Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Resent-Message-Id: <"FvKzq.0.5O1.GyRSn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1053 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 98 Status: RO Content-Type: text/plain; charset="US-ASCII" Content-Length: 3407 > I have made my own class with my own attributes. How do I implement > it so that other objects can get notifyed if an object of my class > change an attribute? You don't. All you have to do is only change attributes of your object using set(), and in your set method handler add return (DoSuperMethodA(cl, obj, msg)); at the end. When some other class puts a notification on one of your attributes, and your attribute gets changed using set() (or OM_SET), then when it does the DoSuperMethod() call the OM_SET will eventually reach the root class of all MUI classes -- Notify.mui. This keeps a list of notifications to be performed. Here's some actual code from my program: /* This is setting up a notification on the MUIA_Robot_FrameRate * attribute */ DoMethod(MyObj, MUIM_Notify, MUIA_Robot_FrameRate, MUIV_EveryTime, FrameCntObj, 4, MUIM_SetAsString, MUIA_Text_Contents, MUIX_R"%ld", MUIV_TriggerValue ); ... /* This is setting the frame rate (actually done within the class * itself -- ie. I use set() rather than just changing the value * directly in case there are notifications on it. */ set(obj, MUIA_Robot_FrameRate, data->framecnt - data->lastframecnt); ... /* This is the relevant part of my custom class's OM_SET method * handler. */ static ULONG mSet(struct IClass * cl, Object * obj, Msg msg) { struct MyData *data = INST_DATA(cl, obj); struct TagItem *tags, *tag; for (tags = ((struct opSet *) msg)->ops_AttrList; tag = NextTagItem(&tags);) { switch (tag->ti_Tag) { ... case MUIA_Robot_FrameRate: data->framerate = (ULONG) tag->ti_Data; break; ... } } return(DoSuperMethodA(cl, obj, msg)); } That's it. Notification happens transparently, the only thing you need to do is pass the method up to your superclass, and you should be doing that anyway -- you don't need to use the approach that non-MUI BOOPSI classes use. > - How much of the opUpdate structure do MUI need in an OM_NOTIFY > call and where do you get it? Don't use OM_NOTIFY. > - Does MUI use OM_UPDATE? I gess not, because other objects have No. > no problem notifying objects of my class, and OM_NOTIFY sends an > OM_UPDATE to all the object's targets (BOOPSI - what a mess ). That's why. :-) > I gess that MUI handle the OM_UPDATE calls at some SuperSuper > class, and then update the actual attributes with OM_SET calls? Yes, except that MUI doesn't use OM_UPDATE AFAIK -- the OM_SET itself triggers the notifications, and they are performed using OM_SETs. > - Is it possible to OM_NOTIFY other places than in OM_SET? (I sure > hope so). You can place a notification on any (public) attribute of any class (or its ancestors) using the MUIM_Notify method. These notifications can be placed at any time from anywhere. > If someone got some example code I would be greatfull!!! Hope this helps. Basically, MUI doesn't use BOOPSI's notification system. Thankfully. :-) > Hans Henrik Happe -- Jason S Birch ,-_|\ email: jasonb@cs.uwa.edu.au Department of Computer Science / \ Tel (work): +61 9 380 1840 The University of Western Australia *_.-._/ Fax (work): +61 9 380 1089 Nedlands W. Australia 6907 v Tel (home): +61 9 386 8630 From: "Stefano Agostinelli" Date: Mon, 15 Apr 1996 19:05:17 +0100 X-Mailer: IntuiNews 1.3 (27.8.95) Subject: Re: Notify in MCC Message-Id: <65641435%agos001@pn.itnet.it> Resent-Message-Id: <"G-gTy2.0.AC5.PGeSn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1060 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 2846 X-Lines: 67 Status: RO Hans Henrik Happe wrote in a Mail about "Re: Notify in MCC": > > "other objects" have to request notification via MUIM_Notify. > > Read MUIC_Notify AutoDoc for its usage. > > (There was a little error in my previus reply, but here it is) > > Well, maybee my previus messages was a litle foggy :) > > I have made my own class with my own attributes. How do I implement > it so that other objects can get notifyed if an object of my class > change an attribute? That's very simple.You can put notification on every attribute of your custom class.That's assuming your class is derived from MUIC_Notify.Then MUI will automagically execute the notification whenever you set an attribute. > - How much of the opUpdate structure do MUI need in an OM_NOTIFY > call and where do you get it? > - Does MUI use OM_UPDATE? I gess not, because other objects have > no problem notifying objects of my class, and OM_NOTIFY sends an > OM_UPDATE to all the object's targets (BOOPSI - what a mess ). > I gess that MUI handle the OM_UPDATE calls at some SuperSuper > class, and then update the actual attributes with OM_SET calls? > - Is it possible to OM_NOTIFY other places than in OM_SET? (I sure > hope so). > OM_NOTIFY? You cannot use "classic" BOOPSI notification for MUI classes. Use MUIM_Notify method.MUI notification is far more powerful than BOOPSI one (which is in fact only mapping of attributes). > What I have tryed this in OM_SET: > > TagItem ti[3]; > > ti[0].ti_Tag = MUIA_Something; > ti[0].ti_Data= data->something; > ti[1].ti_Tag = TAG_END; > > DoSuperMethod(cl, obj, OM_NOTIFY, ti, msg->ops_GInfo, 0); No! We're talking about MUI objects not standard BOOPSI ones. Again read MUIC_Notify AutoDoc and have a look at MUI example code in muidevxx.lha. > If someone got some example code I would be greatfull!!! Suppose your class use the custom attribute MUIA_HHH_MyAttr. Other objects can ask MUI to be notified whenever this attribute is set()ted to a given value,for example you can have something like this: DoMethod(obj1,MUIM_Notify,MUIA_HHH_MyAttr,32,obj2,1,MUIM_MyObj_Changed); Here object obj2 asks to be notified with method MUIM_MyObj_Changed whenever the attribute MUIA_HHH_MyAttr of obj1 is set()ted to 32. Cheers Stefano From: Jason S Birch Message-Id: <199604160510.NAA11193@decadence> Subject: Re: Notify in MCC To: mui@sunsite.Informatik.RWTH-Aachen.DE Date: Tue, 16 Apr 1996 13:10:02 +0800 (WST) In-Reply-To: <60805511@informatik.uni-bremen.de> from "Kai Hofmann" at Apr 15, 96 06:11:10 pm X-Mailer: ELM [version 2.4 PL25] Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Resent-Message-Id: <"Tj_CW3.0.Us.vloSn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1068 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 34 Status: RO Content-Type: text/plain; charset="US-ASCII" Content-Length: 1606 > How about attributes that should only be read-only for users, but must be > set from within the class? > What I want to know is how to protect the read-only attribut from beeing > set by the user (when I by myself have an internal need to set the attribu= > t > so that the user can be noticed by a notify (if he sets one)? I don't think there's a standard way (too much of the BOOPSI implementation of method handling is left up to the programmer for the system to be able to enforce it), but I can think of a quick workaround: Let's say you have an attribute MUIA_Xxx_Yyy that is readable and notifiable, and recognized by mGet() (your OM_GET method). Internally it reads from data->Yyy. Further, let's say you have a private attribute MUIA_Xxx_YyyP (probably best to give it a numeric value quite different to the rest in your class) that is recognized by mSet() and writes to data->Yyy. mSet(), however, does *not* recognize MUIA_Xxx_Yyy. The code in the mSet() switch statement that recognizes MUIA_Xxx_YyyP, in addition to writing to data->Yyy, changes tag->ti_Tag to MUIA_Xxx_Yyy. Then, when the DoSuperMethodA() call is made, Notify class recognizes the attribute that was changed as MUIA_Xxx_Yyy and correctly performs the notification. Sound reasonable? > Kai Hofmann EMail: i07m@zfn.uni-bremen.de -- Jason S Birch ,-_|\ email: jasonb@cs.uwa.edu.au From: Thomas Ganter To: mui@sunsite.Informatik.RWTH-Aachen.DE Date: Fri, 19 Apr 1996 12:24:23 +0200 In-Reply-To: <199604160510.NAA11193@decadence> from "Jason S Birch" at Apr 16, 96 07:10:02 am X-Mailer: ELM [version 2.4 PL25 ME8] Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Message-Id: <96Apr19.122437met_dst.192014@sunbulirsch11.mathematik.tu-muenchen.de> Resent-Message-Id: <"VcJsL3.0.zB5.-esTn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1107 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 66 Status: RO Content-Type: text/plain; charset="US-ASCII" Content-Length: 2694 [ Citation of Jason S Birch ] > > How about attributes that should only be read-only for users, but must be > > set from within the class? > > What I want to know is how to protect the read-only attribut from beeing > > set by the user (when I by myself have an internal need to set the attribu= > > t > > so that the user can be noticed by a notify (if he sets one)? > > I don't think there's a standard way (too much of the BOOPSI > implementation of method handling is left up to the programmer for the > system to be able to enforce it), but I can think of a quick > workaround: > > Let's say you have an attribute MUIA_Xxx_Yyy that is readable and > notifiable, and recognized by mGet() (your OM_GET method). Internally > it reads from data->Yyy. Further, let's say you have a private > attribute MUIA_Xxx_YyyP (probably best to give it a numeric value quite > different to the rest in your class) that is recognized by mSet() and > writes to data->Yyy. mSet(), however, does *not* recognize MUIA_Xxx_Yyy. > The code in the mSet() switch statement that recognizes MUIA_Xxx_YyyP, > in addition to writing to data->Yyy, changes tag->ti_Tag to > MUIA_Xxx_Yyy. Then, when the DoSuperMethodA() call is made, Notify > class recognizes the attribute that was changed as MUIA_Xxx_Yyy and > correctly performs the notification. > > Sound reasonable? > > > Kai Hofmann EMail: i07m@zfn.uni-bremen.de > > Jason S Birch ,-_|\ email: jasonb@cs.uwa.edu.au Hm, and why not simply make up a struct opSet with my gettable-only-attribute and call DoSuperMethod direclty each time MYA_Only_Readable has changed internally? Perhaps a VOID NotifyValue(struct IClass *cl, Object *obj, ULONG Attr, ULONG Val) { ULONG TagList[] = {Attr, Val, TAG_DONE}; struct upSet ops = {OM_SET, (struct TagItem *) TagList}; /* I'm writing this from memory assuming opSet is {ULONG ID; struct TagItem* tagList;} */ DoSuperMethod(cl,obj,(Msg)ops); } that does this job will help? If this isn't legal (although i don't know why it souldn't be), indicate why? It seems to work though... Subject: Re: Notification on setting own data To: mui@sunsite.Informatik.RWTH-Aachen.DE Date: Wed, 22 May 1996 12:01:56 +0800 (WST) In-Reply-To: <9605212127.AA002wg@danpink.demon.co.uk> from "Daniel Pink" at May 21, 96 09:27:09 pm X-Mailer: ELM [version 2.4 PL25] Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Resent-Message-Id: <"ZilLv1.0.5P.58fen"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1375 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 35 Status: RO Content-Type: text/plain; charset="US-ASCII" Content-Length: 1193 > Hi all, > > =20 I've been writing an MUI program using custom classes, but have com= > e > to a sticking point. I want to be able to use MUIM_Notify to trigger > on changing data in my class (i.e. with MUIM_SET). As I'm sure you've > gathered by now, I don't seem to be able to do this :), the data is > altered, but no notification happens. Do I need to do something specia= > l > in my OM_SET method, or am I missing somthing obvious? Make sure your OM_SET method includes a line like: return (DoSuperMethodA(cl, obj, msg)); at the end. This will pass on the OM_SET up the class hierarchy to Notify.mui, which will then perform the notifications. The other thing, of course, is to always use set() whenever you want to change a value, rather than just assigning it directly. Only within the OM_SET method should you assign it directly. > Thanks in advance, > > Daniel, Cheers, Jason. From: "Stefan Stuntz" Date: Mon, 24 Jun 1996 19:23:39 +0100 X-Mailer: IntuiNews 1.3b Beta 7 (2.2.96) Subject: Re: removing notification for a specific target object Message-ID: <81322830@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-ID: <"dimc9.0.PR6.7ikpn"@susi> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.de Reply-To: mui@sunsite.Informatik.RWTH-Aachen.de X-Mailing-List: archive/latest/1625 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.de Content-Type: text Content-Length: 872 X-Lines: 22 Status: RO Ellis Pritchard wrote in article <9605221622.AA09255@cam-ani.co.uk>: > > > However, some of the objects which want to hear about the attribute > > > are only temporary, and may get deleted at any time, so my question > > > is, how can I remove a notification for a particular target object? > > > > MUI has no mechanism for this. You will have to implement something > > yourself, e.g. let your application class keep a custom list of objects > > and handle the notification yourself. > > Yep, this was the first way I thought of doing it, but do you plan to support > per-object removal in a future MUI? Surely MUI must keep an object list > for notification internally to the Notify class data? > > Something like DoMethod(obj, MUIM_KillNotifyObj, MUIA_???, targetobj) > would be nice... A method like this will be part of the next MUI release. -- Greetings, Stefan